]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Escape % in g_app_info_create_from_commandline
authorOwen Taylor <otaylor@src.gnome.org>
Sat, 17 Jan 2009 14:41:45 +0000 (14:41 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Sat, 17 Jan 2009 14:41:45 +0000 (14:41 +0000)
g_app_info_create_from_commandline supports % escapes for
file name, icon name, etc, so we need to escape the command line
we pass in. If it contains an URL with url-encoded UTF-8 it will
typically have some percent signs.

(Reported by Achim Frase)

svn path=/trunk/; revision=151

js/ui/docDisplay.js

index c9af0cf54f20cafad5cbd9bad802504aae5e4a4f..436385d358dc1eccfe3cf7df4b09dfe232470e40 100644 (file)
@@ -70,7 +70,13 @@ DocDisplayItem.prototype = {
             log("Will open a document with the following command: " + appExec);
             // TODO: Change this once better support for creating GAppInfo is added to 
             // GtkRecentInfo, as right now this relies on the fact that the file uri is
-            // already a part of appExec, so we don't supply any files to appInfo.launch().   
+            // already a part of appExec, so we don't supply any files to appInfo.launch().
+
+            // The 'command line' passed to create_from_command_line is allowed to contain
+            // '%<something>' macros that are exapnded to file name / icon name, etc,
+            // so we need to escape % as %%
+            appExec = appExec.replace(/%/g, "%%");
+
             let appInfo = Gio.app_info_create_from_commandline(appExec, null, 0, null);
             appInfo.launch([], null, null);
         } else {